package com.wzdigit.wms.wms.rpc.mes2sap;

import com.wzdigit.framework.exception.RestStatusException;
import com.wzdigit.wms.basic.domain.oqc.OqcInsp;
import com.wzdigit.wms.wms.api.mes2sap.Mes2SapApi;
import com.wzdigit.wms.wms.dto.oqc.OqcInspDto;
import com.wzdigit.wms.wms.service.wms2sap.ReportCheckService;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * MES系统向SAP系统交换信息的接口实现
 */
@Service(version = "${dubbo.providers.wms.ReportCheck.api:1.0.0}")
public class ReportCheckRpcService implements Mes2SapApi {

    @Autowired
    private ReportCheckService reportCheckService;


    @Override
    public boolean reportAndUpdateImmediately(OqcInspDto oqcInspDto, Integer count, String loginName) throws RestStatusException {

        OqcInsp oqcInsp = new OqcInsp();
        BeanUtils.copyProperties(oqcInspDto, oqcInsp);
        boolean flag = reportCheckService.reportAndUpdateImmediately(oqcInsp, count, loginName);
        return flag;
    }
}
